home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility2 / resgauge.zip / RESGAUGE.H < prev    next >
C/C++ Source or Header  |  1992-08-23  |  7KB  |  221 lines

  1. // ============================================================================
  2. // resgauge.h -- header file for ResGauge.
  3. // ============================================================================
  4.  
  5.  
  6. #ifndef RESGAUGE_H
  7.     #define RESGAUGE_H
  8.  
  9.     // -------------
  10.     // menu item IDs
  11.     // -------------
  12.     #define SC_KEEP_ON_TOP    100
  13.     #define SC_CONFIGURE      101
  14.     #define SC_ABOUT          102
  15.  
  16.     // --------------
  17.     // dialog box IDs
  18.     // --------------
  19.     #define IDDB_ABOUT        1
  20.     #define IDDB_CONFIGURE    2
  21.  
  22.     // --------------------------
  23.     // "About..." dialog item IDs
  24.     // --------------------------
  25.     #define IDD_ABOUT1        100
  26.     #define IDD_ABOUT2        101
  27.     #define IDD_ABOUT3        102
  28.     #define IDD_ABOUT4        103
  29.     #define IDD_ABOUT5        104
  30.     #define IDD_ABOUT6        105
  31.     #define IDD_ABOUT7        106
  32.     #define IDD_ABOUT8        107
  33.     #define IDD_ABOUT9        108
  34.     #define IDD_ABOUT10       109
  35.     #define LAST_ABOUT        109
  36.  
  37.     // ------------------------------
  38.     // "Configure..." dialog item IDs
  39.     // ------------------------------
  40.     #define IDD_USER          100
  41.     #define IDD_GDI           101
  42.     #define IDD_BOTH          102
  43.     #define IDD_GAUGE_COLOR   103
  44.     #define IDD_ENABLE        104
  45.     #define IDD_BEEP          105
  46.     #define IDD_FLASH         106
  47.     #define IDD_THRESHOLD     107
  48.     #define IDD_MINUS         108
  49.     #define IDD_PLUS          109
  50.     #define IDD_APPLY         110
  51.     #define IDD_DEFAULT       111
  52.     #define LAST_CONFIG       111
  53.     #define IDD_PERCENT       112
  54.  
  55.     // ----------------
  56.     // string table IDs
  57.     // ----------------
  58.     #define IDS_ALARM_ENABLED 1
  59.     #define IDS_ALARM_TYPE    2
  60.     #define IDS_APPLICATION   3
  61.     #define IDS_BEEP          4
  62.     #define IDS_BOTH          5
  63.     #define IDS_COLOR_BOTH    6
  64.     #define IDS_COLOR_GDI     7
  65.     #define IDS_COLOR_USER    8
  66.     #define IDS_FALSE         9
  67.     #define IDS_FLASH         10
  68.     #define IDS_FORMAT_BOTH   11
  69.     #define IDS_FORMAT_GDI    12
  70.     #define IDS_FORMAT_USER   13
  71.     #define IDS_GDI           14
  72.     #define IDS_KEEP_ON_TOP   15
  73.     #define IDS_MONITOR       16
  74.     #define IDS_PROFILE       17
  75.     #define IDS_THRESHOLD     18
  76.     #define IDS_TIMER_ERROR   19
  77.     #define IDS_TRUE          20
  78.     #define IDS_USER          21
  79.  
  80.     #define IDSM_ABOUT        22
  81.     #define IDSM_CONFIGURE    23
  82.     #define IDSM_KEEP_ON_TOP  24
  83.  
  84.     #ifndef RC_INVOKED
  85.         // -----------------------
  86.         // miscellaneous constants
  87.         // -----------------------
  88.         #define TIMER_ID  1
  89.         #define TIMER_MS  500
  90.         #define WM_REVERT WM_USER
  91.  
  92.         // --------------------
  93.         // enumerated constants
  94.         // --------------------
  95.         enum
  96.         {
  97.             ALARM_BEEP,
  98.             ALARM_FLASH
  99.         };
  100.         enum
  101.         {
  102.             MONITOR_USER,
  103.             MONITOR_GDI,
  104.             MONITOR_BOTH
  105.         };
  106.  
  107.         // --------------
  108.         // data structure
  109.         // --------------
  110.         typedef struct config
  111.         {
  112.             BOOL  fAlarmEnabled; // TRUE if the alarm is enabled
  113.             BOOL  fKeepOnTop;    // TRUE if "Keep on top" is selected
  114.             WORD  wAlarmType;    // beep or flash
  115.             WORD  wMonitor;      // GDI, User, or both
  116.             WORD  wThreshold;    // percent at which alarm sounds
  117.             DWORD dwColorGDI;    // gauge color for GDI
  118.             DWORD dwColorUser;   // gauge color for User
  119.             DWORD dwColorBoth;   // gauge color for both
  120.         } CONFIG;
  121.         typedef CONFIG * PCONFIG;
  122.  
  123.         typedef struct offset
  124.         {
  125.             WORD wX;
  126.             WORD wY;
  127.         } OFFSET;
  128.  
  129.         // -------
  130.         // about.c
  131.         // -------
  132.         BOOL CALLBACK AboutDlgProc(HWND   hDlg,
  133.                                    UINT   msg,
  134.                                    WPARAM wParam,
  135.                                    LPARAM lParam);
  136.  
  137.         // --------
  138.         // config.c
  139.         // --------
  140.         BOOL CALLBACK ConfigDlgProc(HWND   hDlg,
  141.                                     UINT   msg,
  142.                                     WPARAM wParam,
  143.                                     LPARAM lParam);
  144.         void FAR PASCAL InitConfigDlg(HWND hDlg);
  145.         BOOL FAR PASCAL ConfigCommand(HWND    hDlg,
  146.                                       PCONFIG pConfig,
  147.                                       WPARAM  wParam,
  148.                                       LPARAM  lParam);
  149.         void FAR PASCAL EnableAlarmControls(HWND hDlg,
  150.                                             BOOL fEnable);
  151.         BOOL FAR PASCAL DoColor(HWND        hWnd,
  152.                                 DWORD FAR * lpdwColor);
  153.  
  154.         // ------
  155.         // init.c
  156.         // ------
  157.         void FAR PASCAL ProcessCmdLine(LPSTR lpstrCmdLine);
  158.         BOOL FAR PASCAL InitApplication(HINSTANCE hPrevInstance);
  159.         BOOL FAR PASCAL InitInstance(void);
  160.  
  161.         // ---------
  162.         // profile.c
  163.         // ---------
  164.         void FAR PASCAL SaveConfig(void);
  165.         void FAR PASCAL GetConfig(void);
  166.         void FAR PASCAL SaveKeepOnTop(void);
  167.         UINT FAR PASCAL DecodeHexString(LPSTR       lpstrValue,
  168.                                         DWORD FAR * dwValue);
  169.  
  170.         // ----------
  171.         // resgauge.c
  172.         // ----------
  173.         LRESULT WINAPI MainWndProc(HWND   hWnd,
  174.                                    UINT   msg,
  175.                                    WPARAM wParam,
  176.                                    LPARAM lParam);
  177.         void FAR PASCAL MainCreate(HWND hWnd);
  178.         void FAR PASCAL MainPaint(HWND hWnd);
  179.         void FAR PASCAL MainTimer(HWND hWnd);
  180.         void FAR PASCAL HandleKeepOnTop(HWND  hWnd,
  181.                                         HMENU hMenu,
  182.                                         BOOL  fKeepOnTop);
  183.         void FAR PASCAL CenterDialog(HWND hDlg);
  184.         WORD FAR PASCAL GetSystemResources(void);
  185.         void FAR PASCAL FormatLabel(void);
  186.  
  187.         // --------------------------------------------------------------------
  188.         // preprocessor macros to make globals resident in the main module:
  189.         //     GARRAY() is used for global arrays;
  190.         //     GINIT() is used for explicitly initialized globals; and
  191.         //     GLOBAL() is used for all other globals.
  192.         // --------------------------------------------------------------------
  193.         #ifdef MAIN
  194.             #define GARRAY(X, Y) X[Y]
  195.             #define GINIT(X, Y)  X = Y
  196.             #define GLOBAL(X)    X
  197.         #else
  198.             #define GARRAY(X, Y) extern X[Y]
  199.             #define GINIT(X, Y)  extern X
  200.             #define GLOBAL(X)    extern X
  201.             extern CONFIG GcfgDef; // ugly but necessary
  202.         #endif
  203.  
  204.         // ----------------------------
  205.         // global/external declarations
  206.         // ----------------------------
  207.         GARRAY(char      GszBuf, 8);
  208.  
  209.         GLOBAL(CONFIG    GcfgCur);
  210.         GLOBAL(HINSTANCE GhInst);
  211.         GLOBAL(WORD      GwFree);
  212.     #endif
  213.  
  214.  
  215. #endif
  216.  
  217.  
  218. // =================
  219. // end of resgauge.h
  220. // =================
  221.